package com.lnu.information.util;

import java.io.File;
import java.io.FileOutputStream;

/**
 * @author : jian.zhang-2
 * @description:
 * @date : Create in 6:01 PM 2022/3/13
 * @modified By :
 */
public class FileUtil {

    public static File uploadFile(byte[] file, String filePath, String fileName) throws Exception {
        File targetFile = new File(filePath);
        if(!targetFile.exists()){
            targetFile.mkdirs();
        }
        FileOutputStream out = new FileOutputStream(filePath+fileName);
        out.write(file);
        out.flush();
        out.close();
        return new File(filePath+fileName);
    }
}
